// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported Overview */
-const { Clutter, GLib, Meta, Shell, St } = imports.gi;
+const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi;
const Signals = imports.signals;
const Background = imports.ui.background;
}
};
+var OverviewActor = GObject.registerClass(
+class OverviewActor extends St.BoxLayout {
+ _init() {
+ super._init({
+ name: 'overview',
+ /* Translators: This is the main view to select
+ activities. See also note for "Activities" string. */
+ accessible_name: _("Overview"),
+ vertical: true
+ });
+
+ this.add_constraint(new LayoutManager.MonitorConstraint({ primary: true }));
+
+ // Add a clone of the panel to the overview so spacing and such is
+ // automatic
+ let panelGhost = new St.Bin({
+ child: new Clutter.Clone({ source: Main.panel }),
+ reactive: false,
+ opacity: 0
+ });
+ this.add_actor(panelGhost);
+
+ this._searchEntry = new St.Entry({
+ style_class: 'search-entry',
+ /* Translators: this is the text displayed
+ in the search entry when no search is
+ active; it should not exceed ~30
+ characters. */
+ hint_text: _("Type to search…"),
+ track_hover: true,
+ can_focus: true
+ });
+ let searchEntryBin = new St.Bin({
+ child: this._searchEntry,
+ x_align: St.Align.MIDDLE
+ });
+ this.add_actor(searchEntryBin);
+
+ this._controls = new OverviewControls.ControlsManager(this._searchEntry);
+
+ // Add our same-line elements after the search entry
+ this.add(this._controls.actor, { y_fill: true, expand: true });
+ }
+
+ get dash() {
+ return this._controls.dash;
+ }
+
+ get searchEntry() {
+ return this._searchEntry;
+ }
+
+ get viewSelector() {
+ return this._controls.viewSelector;
+ }
+});
+
var Overview = class {
constructor() {
- this._overviewCreated = false;
this._initCalled = false;
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
this._sessionUpdated();
}
+ get dash() {
+ return this._overview.dash;
+ }
+
+ get dashIconSize() {
+ logError(new Error('Usage of Overview.\'dashIconSize\' is deprecated, ' +
+ 'use \'dash.iconSize\' property instead'));
+ return this.dash.iconSize;
+ }
+
+ get viewSelector() {
+ return this._overview.viewSelector;
+ }
+
_createOverview() {
- if (this._overviewCreated)
+ if (this._overview)
return;
if (this.isDummy)
return;
- this._overviewCreated = true;
-
- this._overview = new St.BoxLayout({ name: 'overview',
- /* Translators: This is the main view to select
- activities. See also note for "Activities" string. */
- accessible_name: _("Overview"),
- vertical: true });
- this._overview.add_constraint(new LayoutManager.MonitorConstraint({ primary: true }));
- this._overview._delegate = this;
-
// The main Background actors are inside global.window_group which are
// hidden when displaying the overview, so we create a new
// one. Instances of this class share a single CoglTexture behind the
reactive: true });
Main.layoutManager.overviewGroup.add_child(this._coverPane);
this._coverPane.connect('event', () => Clutter.EVENT_STOP);
-
- Main.layoutManager.overviewGroup.add_child(this._overview);
-
this._coverPane.hide();
// XDND
if (this.isDummy)
return;
- this._shellInfo = new ShellInfo();
-
- // Add a clone of the panel to the overview so spacing and such is
- // automatic
- this._panelGhost = new St.Bin({ child: new Clutter.Clone({ source: Main.panel }),
- reactive: false,
- opacity: 0 });
- this._overview.add_actor(this._panelGhost);
-
- this._searchEntry = new St.Entry({ style_class: 'search-entry',
- /* Translators: this is the text displayed
- in the search entry when no search is
- active; it should not exceed ~30
- characters. */
- hint_text: _("Type to search…"),
- track_hover: true,
- can_focus: true });
- this._searchEntryBin = new St.Bin({ child: this._searchEntry,
- x_align: St.Align.MIDDLE });
- this._overview.add_actor(this._searchEntryBin);
-
- // Create controls
- this._controls = new OverviewControls.ControlsManager(this._searchEntry);
- this._dash = this._controls.dash;
- this.viewSelector = this._controls.viewSelector;
-
- // Add our same-line elements after the search entry
- this._overview.add(this._controls.actor, { y_fill: true, expand: true });
+ this._overview = new OverviewActor();
+ this._overview._delegate = this;
+ Main.layoutManager.overviewGroup.add_child(this._overview);
- // TODO - recalculate everything when desktop size changes
- this.dashIconSize = this._dash.iconSize;
- this._dash.connect('icon-size-changed', () => {
- this.dashIconSize = this._dash.iconSize;
- });
+ this._shellInfo = new ShellInfo();
Main.layoutManager.connect('monitors-changed', this._relayout.bind(this));
this._relayout();
focusSearch() {
this.show();
- this._searchEntry.grab_key_focus();
+ this._overview.searchEntry.grab_key_focus();
}
fadeInDesktop() {
return false;
if (this._inItemDrag || this._inWindowDrag)
return false;
- if (this._activationTime == 0 ||
+ if (!this._activationTime ||
GLib.get_monotonic_time() / GLib.USEC_PER_SEC - this._activationTime > OVERVIEW_ACTIVATION_TIMEOUT)
return true;
return false;
}
getShowAppsButton() {
- return this._dash.showAppsButton;
+ logError(new Error('Usage of Overview.\'getShowAppsButton\' is deprecated, ' +
+ 'use \'dash.showAppsButton\' property instead'));
+
+ return this.dash.showAppsButton;
}
};
Signals.addSignalMethods(Overview.prototype);